home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Docs / Includes / USectionMgr.h < prev   
Encoding:
Text File  |  1996-04-03  |  5.6 KB  |  214 lines  |  [TEXT/MPS ]

  1. // USectionMgr.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4.  
  5. #ifndef __USECTIONMGR__
  6. #define __USECTIONMGR__
  7.  
  8. // MacApp
  9.  
  10. #ifndef __UBEHAVIOR__
  11. #include "UBehavior.h"
  12. #endif
  13.  
  14. #ifndef __UCOMMAND__
  15. #include "UCommand.h"
  16. #endif
  17.  
  18. // Toolbox
  19.  
  20. //----------------------------------------------------------------------------------------
  21. // External and forward class declarations. 
  22. //----------------------------------------------------------------------------------------
  23.  
  24. class TDocument;
  25. class TPublisher;
  26. class TSection;
  27. class TSectionList;
  28. class TSubscriber;
  29.  
  30.  
  31. //----------------------------------------------------------------------------------------
  32. // Constants
  33. //----------------------------------------------------------------------------------------
  34.  
  35. const IDType kSectionMgrBehaviorID = 'smgr';            // behavior id for section mgr
  36.  
  37. //----------------------------------------------------------------------------------------
  38. // TSectionMgr: This object is responsible for interaction with the Edition manager
  39. //----------------------------------------------------------------------------------------
  40.  
  41. class TSectionMgr : public TBehavior
  42. {
  43.     MA_DECLARE_CLASS;
  44.     
  45. public:
  46.  
  47.     TSectionList* fSectionList;
  48.  
  49.     TSectionMgr();
  50.         // Empty constructor to satisfy compiler.
  51.         
  52.     void ISectionMgr();
  53.         // initialize
  54.  
  55.     virtual ~TSectionMgr();
  56.         // frees this object
  57.  
  58.     virtual void DoAESectionEvent(CommandNumber aCommandNumber,
  59.                                   const AppleEvent& message,
  60.                                   const AppleEvent& reply);
  61.         // responds to the edition manager apple events
  62.  
  63. };
  64.  
  65.  
  66. //----------------------------------------------------------------------------------------
  67. // TSectionCommand: an abstract superclass used as the base class for the edition manager
  68. // apple event command classes
  69. //----------------------------------------------------------------------------------------
  70.  
  71. class TSectionCommand : public TServerCommand
  72. {
  73.     MA_DECLARE_CLASS;
  74.     
  75. public:
  76.     TSection* fSection;                            // section object for this apple event
  77.                                                 // command
  78.  
  79.     TSectionCommand();
  80.         // Empty constructor to satisfy compiler.
  81.     virtual ~TSectionCommand();
  82.         // Destructor
  83.         
  84.     void ISectionCommand(CommandNumber itsCommandNumber,
  85.                          TDocument* itsDocument,
  86.                          TSection* itsSection);
  87.         // initialize this command
  88.  
  89.     void ISectionCommand(CommandNumber itsCommandNumber,
  90.                          const AppleEvent& itsMessage,
  91.                          const AppleEvent& itsReply);
  92.         // initialize this command from the AppleEvent stream
  93. };
  94.  
  95.  
  96. //----------------------------------------------------------------------------------------
  97. // TSectionReadEventCommand
  98. //----------------------------------------------------------------------------------------
  99.  
  100. class TSectionReadEventCommand : public TSectionCommand
  101. {
  102.     MA_DECLARE_CLASS;
  103.     
  104. public:
  105.  
  106.     TSectionReadEventCommand();
  107.         // Empty constructor to satisfy compiler.
  108.     virtual ~TSectionReadEventCommand();
  109.         // Destructor
  110.         
  111.     void ISectionReadEventCommand(CommandNumber itsCommandNumber,
  112.                                   TDocument* itsDocument,
  113.                                   TSubscriber* itsSubscriber);
  114.         // initialize this command
  115.  
  116.     virtual void DoIt();
  117.         // call ((TSubscriber)fSection)->Subscribe
  118. };
  119.  
  120.  
  121. //----------------------------------------------------------------------------------------
  122. // TSectionWriteEventCommand
  123. //----------------------------------------------------------------------------------------
  124.  
  125. class TSectionWriteEventCommand : public TSectionCommand
  126. {
  127.     MA_DECLARE_CLASS;
  128.     
  129. public:
  130.  
  131.     TSectionWriteEventCommand();
  132.         // Empty constructor to satisfy compiler.
  133.     virtual ~TSectionWriteEventCommand();
  134.         // Destructor
  135.         
  136.     void ISectionWriteEventCommand(CommandNumber itsCommandNumber,
  137.                                    TDocument* itsDocument,
  138.                                    TPublisher* itsPublisher);
  139.         // initialize this command
  140.  
  141.     virtual void DoIt();
  142.         // call ((TPublisher)fSection))->Publish
  143. };
  144.  
  145.  
  146. //----------------------------------------------------------------------------------------
  147. // TSectionScrollEventCommand
  148. //----------------------------------------------------------------------------------------
  149.  
  150. class TSectionScrollEventCommand : public TSectionCommand
  151. {
  152.     MA_DECLARE_CLASS;
  153.     
  154. public:
  155.  
  156.  
  157.     TSectionScrollEventCommand();
  158.         // Empty constructor to satisfy compiler.
  159.     virtual ~TSectionScrollEventCommand();
  160.         // Destructor
  161.         
  162.     void ISectionScrollEventCommand(CommandNumber itsCommandNumber,
  163.                                     TDocument* itsDocument,
  164.                                     TSection* itsSection);
  165.         // initialize this command
  166.  
  167.     virtual void DoIt();
  168.         // scrolls the document to the publisher
  169. };
  170.  
  171.  
  172. //----------------------------------------------------------------------------------------
  173. // TSectionCancelEventCommand
  174. //----------------------------------------------------------------------------------------
  175.  
  176. class TSectionCancelEventCommand : public TSectionCommand
  177. {
  178.     MA_DECLARE_CLASS;
  179.     
  180. public:
  181.  
  182.     TSectionCancelEventCommand();
  183.         // Empty constructor to satisfy compiler.
  184.     virtual ~TSectionCancelEventCommand();
  185.         // Destructor
  186.         
  187.     void ISectionCancelEventCommand(CommandNumber itsCommandNumber,
  188.                                     TDocument* itsDocument,
  189.                                     TSection* itsSection);
  190.         // initialize this command
  191.  
  192.     virtual void DoIt();
  193.         // cancels this section
  194.  
  195.     virtual void UndoIt();
  196.         // un-cancels this section
  197.         
  198.     //    virtual void Commit();
  199.     //        // Actually cancel the section by unregistering it
  200.  
  201. };
  202.  
  203.  
  204. //----------------------------------------------------------------------------------------
  205. // Global function declarations
  206. //----------------------------------------------------------------------------------------
  207.  
  208. extern void InitUSectionMgr();
  209.     // Initialize the section manager and attach it to the application. Note that the
  210.     // application should already have been instantiated and initialized when this
  211.     // procedure is called.
  212.  
  213. #endif // __USECTIONMGR__
  214.